<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>时间</title>
<link type="text/css" rel="stylesheet"  href="/bbs/css/index.css"/>
</head>
<body>
	
	<div id = "div_olNum">在线人数: <font class="f_login" id="f_olNum" color="red" ></font></div>
	<div id = "div_time" ></div>
		
<script type="text/javascript"> 
	
	function showOlNum(){
		<%	
		   Integer olNum =  (Integer)(request.getServletContext().getAttribute("olNum"));//获取getServletContext中的在线人数
			if(olNum==null){
				olNum=0;
			}
		%>
		document.getElementById("f_olNum").innerHTML=<%=olNum %>;
		
	}
		
	//setInterval("showOlNum()",1000);
	function showTime() {
		var time=new Date();
		
        var year=time.getFullYear(); //获取年份
        
        var month=time.getMonth()+1; //获取月份
        
        var day=time.getDate();  //获取日期
        
        var hour=time.getHours();  //获取时
        
        var minite=time.getMinutes(); //获取分
        
        var second=time.getSeconds();  //获取秒
        if(second<10){
        	second = "0"+second;
        }
		document.getElementById("div_time").innerHTML=year+"年"+month+"月"+day+"日 "+hour+":"+minite+":"+second;
	}
	 setInterval("showTime(),showOlNum()",1000);
	
</script>
</body>
</html>